package androidx.transition;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ObjectAnimator;
import android.animation.TypeEvaluator;
import android.content.Context;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.core.view.ViewCompat;
import o.nl;
import o.nx;
import o.oi;

public class ChangeClipBounds extends Transition {
    private static final String[] ˋ = new String[]{"android:clipBounds:clip"};

    public String[] ˋ() {
        return ˋ;
    }

    public ChangeClipBounds(Context context, AttributeSet attributeSet) {
        super(context, attributeSet);
    }

    private void ˎ(nx nxVar) {
        View view = nxVar.ॱ;
        if (view.getVisibility() != 8) {
            Rect ˉ = ViewCompat.ˉ(view);
            nxVar.ˊ.put("android:clipBounds:clip", ˉ);
            if (ˉ == null) {
                nxVar.ˊ.put("android:clipBounds:bounds", new Rect(0, 0, view.getWidth(), view.getHeight()));
            }
        }
    }

    public void ˋ(@NonNull nx nxVar) {
        ˎ(nxVar);
    }

    public void ॱ(@NonNull nx nxVar) {
        ˎ(nxVar);
    }

    public Animator ˋ(@NonNull ViewGroup viewGroup, nx nxVar, nx nxVar2) {
        if (nxVar == null || nxVar2 == null || !nxVar.ˊ.containsKey("android:clipBounds:clip") || !nxVar2.ˊ.containsKey("android:clipBounds:clip")) {
            return null;
        }
        int i;
        Rect rect = (Rect) nxVar.ˊ.get("android:clipBounds:clip");
        Object obj = (Rect) nxVar2.ˊ.get("android:clipBounds:clip");
        if (obj == null) {
            i = 1;
        } else {
            i = 0;
        }
        if (rect == null && obj == null) {
            return null;
        }
        if (rect == null) {
            rect = (Rect) nxVar.ˊ.get("android:clipBounds:bounds");
        } else if (obj == null) {
            Rect rect2 = (Rect) nxVar2.ˊ.get("android:clipBounds:bounds");
        }
        if (rect.equals(obj)) {
            return null;
        }
        ViewCompat.ˎ(nxVar2.ॱ, rect);
        TypeEvaluator nlVar = new nl(new Rect());
        Animator ofObject = ObjectAnimator.ofObject(nxVar2.ॱ, oi.ˎ, nlVar, new Rect[]{rect, obj});
        if (i == 0) {
            return ofObject;
        }
        final View view = nxVar2.ॱ;
        ofObject.addListener(new AnimatorListenerAdapter(this) {
            final /* synthetic */ ChangeClipBounds ˏ;

            public void onAnimationEnd(Animator animator) {
                ViewCompat.ˎ(view, null);
            }
        });
        return ofObject;
    }
}
